/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import entities.Class;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author corneliugosa
 */
@Stateless
public class ClassFacade extends AbstractFacade<Class> implements ClassFacadeLocal {
    @PersistenceContext(unitName = "School-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ClassFacade() {
        super(Class.class);
    }

    @Override
    public Class findById(Integer id) {
        Class cls = null;
        
        Query query = em.createNamedQuery("Exams.findById");
        query.setParameter("id", id);
        cls = (Class)query.getSingleResult();
        
        return cls;
    }
    
}
